/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.vivo.material.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import com.thinkgem.jeesite.common.utils.excel.annotation.ExcelField;

import com.thinkgem.jeesite.common.persistence.TreeEntity;

/**
 * 物料类别Entity
 * @author jyangye
 * @version 2017-11-27
 */
public class ViMaterialkind extends TreeEntity<ViMaterialkind> {
	
	private static final long serialVersionUID = 1L;
	private ViMaterialkind parent;		// 父物料类别ID
	private String parentIds;		// 父物料类别IDS
	private String materialkindattr;		// 物料类别属性
	private String materialkindcode;		// 物料类别编码
	private String materialkindname;		// 物料类别名称
	private String materialkinddescription;		// 物料类别描述
	
	public ViMaterialkind() {
		super();
	}

	public ViMaterialkind(String id){
		super(id);
	}

	@JsonBackReference
	@NotNull(message="父物料类别ID不能为空")
	@ExcelField(title="父物料类别ID", align=2, sort=20)
	public ViMaterialkind getParent() {
		return parent;
	}

	public void setParent(ViMaterialkind parent) {
		this.parent = parent;
	}
	
	@Length(min=1, max=2000, message="父物料类别IDS长度必须介于 1 和 2000 之间")
	@ExcelField(title="父物料类别IDS", align=2, sort=30)
	public String getParentIds() {
		return parentIds;
	}

	public void setParentIds(String parentIds) {
		this.parentIds = parentIds;
	}
	
	@Length(min=1, max=1, message="物料类别属性长度必须介于 1 和 1 之间")
	@ExcelField(title="物料类别属性", align=2, sort=40)
	public String getMaterialkindattr() {
		return materialkindattr;
	}

	public void setMaterialkindattr(String materialkindattr) {
		this.materialkindattr = materialkindattr;
	}
	
	@Length(min=1, max=20, message="物料类别编码长度必须介于 1 和 20 之间")
	@ExcelField(title="物料类别编码", align=2, sort=50)
	public String getMaterialkindcode() {
		return materialkindcode;
	}

	public void setMaterialkindcode(String materialkindcode) {
		this.materialkindcode = materialkindcode;
	}
	
	@Length(min=1, max=100, message="物料类别名称长度必须介于 1 和 100 之间")
	@ExcelField(title="物料类别名称", align=2, sort=60)
	public String getMaterialkindname() {
		return materialkindname;
	}

	public void setMaterialkindname(String materialkindname) {
		this.materialkindname = materialkindname;
	}
	
	@Length(min=0, max=500, message="物料类别描述长度必须介于 0 和 500 之间")
	@ExcelField(title="物料类别描述", align=2, sort=70)
	public String getMaterialkinddescription() {
		return materialkinddescription;
	}

	public void setMaterialkinddescription(String materialkinddescription) {
		this.materialkinddescription = materialkinddescription;
	}
	
	public String getParentId() {
		return parent != null && parent.getId() != null ? parent.getId() : "0";
	}
}